package com.zr.gdms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zr.gdms.model.User;
import com.zr.gdms.service.SdepartSelectStudentService;
import com.zr.gdms.serviceimpl.SdepartSelectStudentServiceimpl;

import net.sf.json.JSONObject;
  //根据院系查询学生信息
public class SdepartSelectStuController extends HttpServlet {
		SdepartSelectStudentService ss=new SdepartSelectStudentServiceimpl();
	@Override
		protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
			// TODO Auto-generated method stub
			doPost(req, resp);
		}
		@Override
		protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
			req.setCharacterEncoding("utf8");
			resp.setCharacterEncoding("utf8");
			HttpSession session=req.getSession();
			PrintWriter pt=resp.getWriter();
			int page=Integer.parseInt(req.getParameter("page"));
			int rows=Integer.parseInt(req.getParameter("rows"));		
				JSONObject j=ss.getStudents(page, rows);
				pt.write(j.toString());
			    pt.flush();
			    pt.close();
		}
}
